<template>
  <svg class="svg_icon"
       :class="svgClass"
       :style="{fill:color}">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script type='text/ecmascript-6'>
export default {
  name: 'CSvgIcon',
  props: {
    svgClass: {
      type: String,
      default: 'icon'
    },
    name: {
      type: String,
      default: ''
    },
    color: String
  },
  computed: {
    iconName () {
      return `#icon-${this.name}`
    }
  }
}
</script>

<style lang="stylus" rel="stylesheet/stylus">
.svg_icon
  overflow hidden
  width 1em
  height 1em
  vertical-align -0.15em
  fill currentColor
</style>
